<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@ taglib uri="http://www.springframework.org/tags" prefix="s"%>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@ page session="false"%>
<html>
<head>
    <title>eduran.net</title>
    <style type="text/css">
        table th {background-color: #EAEAEA}
    </style>
</head>
<body>
<a href="${pageContext.request.contextPath}/add">Click here to add new record</a>
<h1>All Records</h1>
<div>
    <c:choose>
        <c:when test="${fn:length(personlist)>0}">
            <table id="records" cellpadding="6" cellspacing="1">
                <thead>
                <tr>
                    <th>Edit</th>
                    <th>Delete</th>
                    <th>First Name</th>
                    <th>Last Name</th>
                    <th>Email</th>
                    <th>Cellphone</th>
                    <th>Confirm Key</th>
                    <th>Active</th>
                </tr>
                <c:forEach items="${personlist}" var="p">
                    <tr>
                        <td><a href="<c:url value="/update/${p.email}"/>">EDIT</a></td>
                        <td><a href="<c:url value="/delete/${p.email}"/>">DELETE</a></td>
                        <td><c:out value="${p.firstname}" /></td>
                        <td><c:out value="${p.lastname}" /></td>
                        <td><c:out value="${p.email}" /></td>
                        <td><c:out value="${p.cellphone}" /></td>
                        <td><c:out value="${p.confirmkey}" /></td>
                        <td><c:out value="${p.active}" /></td>
                    </tr>
                </c:forEach>
                </thead>
            </table>
        </c:when>
        <c:otherwise>
            <label>Sorry! No Record To Display</label>
        </c:otherwise>
    </c:choose>
</div>


</body>
</html>